package com.wd.jetpack

import android.content.Intent
import android.view.View
import com.wd.annotation.Route
import com.wd.base.config.Constance
import com.wd.jetpack.base.BaseActivity
import com.wd.jetpack.databinding.ActivityTabMainBinding
import com.wd.jetpack.demo.main.DemoImageActivity
import com.wd.jetpack.demo.novigation.DemoNavigaActivity
import com.wd.jetpack.demo.paging.DemoPagingActivity
import com.wd.jetpack.ui.SplashActivity
import com.wd.jetpack.ui.dapter.SectionsPagerAdapter


/**
 * NA<BR>
 *
 * @author w4425
 * @version [V0.0.1, 2021/6/1]
 * @since V0.0.1
 */
@Route(path = Constance.MODULE_URL_TAB_JETPACK)
class TabMainActivity : BaseActivity<ActivityTabMainBinding>() {

    override fun onClick(v: View) {
    }

    override fun getLayoutId(): Int {
        return R.layout.activity_tab_main
    }

    override fun initView() {
        //        val viewPager: ViewPager = findViewById(R.id.view_pager)
        //        val tabs: TabLayout = findViewById(R.id.tabs)
        //        val fab: FloatingActionButton = findViewById(R.id.fab)

        val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager)
        mBinding.viewPager.adapter = sectionsPagerAdapter
        mBinding.tabs.setupWithViewPager(mBinding.viewPager)

        mBinding.fab.setOnClickListener { view ->
            openPaging()
        }
    }

    override fun initData() {
    }

    /**
     * 跳转到splash页面
     */
    private fun openSplash() {
        var intent = Intent()
        intent.setClass(this, SplashActivity::class.java)
        startActivity(intent)
    }

    /**
     * 跳转到JetPack学习页面
     */
    private fun openDemo() {
        var intent = Intent()
        intent.setClass(this, DemoImageActivity::class.java)
        startActivity(intent)
    }
    /**
     * 跳转到Navigation学习页面
     */
    private fun openNavigation() {
        var intent = Intent()
        intent.setClass(this, DemoNavigaActivity::class.java)
        startActivity(intent)
    }
    /**
     * 跳转到Paging学习页面
     */
    private fun openPaging() {
        var intent = Intent()
        intent.setClass(this, DemoPagingActivity::class.java)
        startActivity(intent)
    }
}